﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using JXT.PrimaryKey.Batman.Core.WcfService;
using JXT.PrimaryKey.Batman.WcfService.Interfaces;
using JXT.PrimaryKey.Batman.WcfService.Models.Quotation;

namespace JXT.PrimaryKey.Batman.WcfService.Client.Wrapper
{
    internal class QuotationWrapperService : WrapperServiceBase, IQuotation
    {
        private IQuotation _quotaion;

        public QuotationWrapperService(IQuotation innerQuotation, string authenticationId, string authenticationKey)
            : base((IClientChannel)innerQuotation, authenticationId, authenticationKey)
        {
            _quotaion = innerQuotation;
        }

        public List<Securities> SearchSecuritiesList(string code, string num)
        {
            return WrapperFunction(() =>
            {
                return _quotaion.SearchSecuritiesList(code, num);
            });
        }

        public List<Securities> GetSecuritiesList(string market)
        {
            return WrapperFunction(() =>
            {
                return _quotaion.GetSecuritiesList(market);
            });
        }

        public MarketStatistic GetSingle(string code, string day)
        {
            return WrapperFunction(() =>
            {
                return _quotaion.GetSingle(code, day);
            });
        }

        public IEnumerable<MarketStatistic> GetList(string code, string firstTime, string lastTime)
        {
            return WrapperFunction(() =>
            {
                return _quotaion.GetList(code, firstTime, lastTime);
            });
        }
    }
}
